package com.example.jta.controller;


import com.example.jta.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("jta")
public class JtaController {
    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "/newOrder", method = {RequestMethod.POST, RequestMethod.GET})
    public String newOrder(@RequestParam(value = "userId") String userId, @RequestParam(value = "productCode") String productCode, @RequestParam(value = "quantity") int quantity) {
        orderService.newOrder(userId, productCode, quantity);
        return "success";
    }
}